Returns a bit pattern that identifies the file type or the name of a volume or a directory.
ボリュームやディレクトリの名前ないしファイルのタイプを示すビットパターン情報を取得して返します。
GetAttr (Text As String)
GetAttr (Text As String)
Integer
整数
Text: Any string expression that contains an unambiguous file specification. You can also use URL notation.
Text: ファイルの位置を明示的に指定した文字列表式。またURL 指定を用いることもできます。
This function determines the attributes for a specified file and returns the bit pattern that can help you to identify the following file attributes:
この関数は、指定ファイルの属性を取得して、下記のファイル属性を示すビットパターンを返します。
0 : Normal files.
0 : 通常のファイル。
1 : Read-only files.
1 : 読み取り専用のファイル。
8 : Returns the name of the volume
8 : ボリュームの名前を返す。
16 : Returns the name of the directory only.
16 : ディレクトリの名前のみを返す。
32 : File was changed since last backup (Archive bit).
32 : 前回のバックアップ時から変更のあったファイル (アーカイブビット)。
If you want to know if a bit of the attribute byte is set, use the following query method:
属性バイトの特定ビットがセットされているかは、下記のような処理で確認できます。
Sub ExampleSetGetAttr
Sub ExampleSetGetAttr
On Error Goto ErrorHandler REM Define target for error-handler
On Error Goto ErrorHandler REM エラーハンドラ用ターゲットを設定
If Dir("C:\test",16)="" Then MkDir "C:\test"
If Dir("C:\test",16)="" Then MkDir "C:\test"
If Dir("C:\test\autoexec.sav")="" THEN Filecopy "c:\autoexec.bat", "c:\test\autoexec.sav"
If Dir("C:\test\autoexec.sav")="" THEN Filecopy "c:\autoexec.bat", "c:\test\autoexec.sav"
SetAttr "c:\test\autoexec.sav" ,0
SetAttr "c:\test\autoexec.sav" ,0
Filecopy "c:\autoexec.bat", "c:\test\autoexec.sav"
Filecopy "c:\autoexec.bat", "c:\test\autoexec.sav"
SetAttr "c:\test\autoexec.sav" ,1
SetAttr "c:\test\autoexec.sav" ,1
print GetAttr( "c:\test\autoexec.sav" )
print GetAttr( "c:\test\autoexec.sav" )
end
End
ErrorHandler:
ErrorHandler:
Print Error
Print Error
end
End
end sub
end sub